package com.totem.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.totem.order.model.TGoodsOrderItems;
import com.totem.order.vo.GoodsOrderPageVO;
import com.totem.order.vo.GoodsOrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TGoodsOrderItemMapper extends BaseMapper<TGoodsOrderItems> {

    @Select("select count(1) from t_orders o, t_goods_order_items goi where o.id=goi.order_id and customer_id=#{customerId} and payment_state='FINISHED'")
    int countByCustomerId(@Param("customerId") Long customerId);

    Long countAll(@Param("vo") GoodsOrderPageVO vo);
    IPage<GoodsOrderVO> findAll(IPage<GoodsOrderVO> page, @Param("vo") GoodsOrderPageVO vo);
    List<GoodsOrderVO> findAll(@Param("vo") GoodsOrderPageVO vo);
}
